#ifndef CLOCALCURRENCY_H
#define CLOCALCURRENCY_H

// Format amount accourding to Local Currency Setting

#include "localCurrency.h"
#include "lib.h"

class ClocalCurrency {

	public:

		ClocalCurrency(localCurrency * aLocale);

		String formatCurrency( int32 amount );

        // kharmon.  11-18-05.  #7145-7149.
        // takes the amount and returns it formatted according to the
        // locale subcurrency settings...e.g., using the cent sign 
        // instead of the dollar sign.
        String formatSubCurrency( int32 amount );

		bool8 showCents(bool8 turnOn)
			{ return changeFlag(SHOWCENTS, turnOn); }

		bool8 showAutomaticCents(bool8 turnOn)
			{ return changeFlag(AUTOMATIC_CENTS, turnOn); }

		bool8 showDollarSign(bool8 turnOn)
			{ return changeFlag(DOLLARSIGN, turnOn); }

		bool8 setAmountInDollars(bool8 turnOn)
			{ return changeFlag(AMOUNT_IN_DOLLARS, turnOn); }

		void setLocale(localCurrency * aLocale);

	private:
		bool8 changeFlag(int8 flag, bool8 turnOn);
		int8  curSymbol(int8 , bool8 , bool8 );
        int8  subCurSymbol(int8 offset, bool8 isNeg, bool8 beginning );

		uint16	buf[32];
		int32	flags;

		localCurrency locale;
		int8	curLength;

		enum Constants
		{
			SHOWCENTS			= 0x1,
			DOLLARSIGN			= 0x2,
			AMOUNT_IN_DOLLARS	= 0x4,
			AUTOMATIC_CENTS		= 0x8
		};

};

#endif
